package com.hinnotek.amoeba.repo

import com.hinnotek.amoeba.api.ApiService
import com.hinnotek.amoeba.base.BaseBean
import com.hinnotek.amoeba.bean.old.CompanyContractNumBean
import com.hinnotek.amoeba.bean.old.ContractTypeAll
import com.hinnotek.amoeba.bean.old.ProductListBean
import com.hinnotek.amoeba.bean.old.ProductManagamentBean
import com.hinnotek.amoeba.bean.old.AmibaProjectListBean
import com.hinnotek.amoeba.bean.old.AmibaSysUserAdminBean
import com.hinnotek.amoeba.bean.old.AmountAllocatedBean
import com.hinnotek.amoeba.bean.old.AmeobaCustomerListBean
import com.hinnotek.amoeba.bean.old.ProjectByCustomerBean
import com.lee.common.base.BaseRepository
import com.lee.common.network.net.StateLiveData
import javax.inject.Inject

class PublicInterfaceRepo @Inject constructor(private val service: ApiService) : BaseRepository() {


    /**
     * app端查询全部合同类型接口
     */
    suspend fun getContractTypeAll(stateLiveData: StateLiveData<MutableList<ContractTypeAll>>) {
        executeResp({ service.getContractTypeList() }, stateLiveData)
    }

    /**
     * app端获取全部产品接口
     */
    suspend fun getProductList(stateLiveData: StateLiveData<MutableList<ProductListBean>>) {
        executeResp({ service.getProductList() }, stateLiveData)
    }


    /**
     * app端获取某个产品下的所有型号接口
     */
    suspend fun getProductTypeListByProductId(
        productId: Int,
        stateLiveData: StateLiveData<MutableList<ProductManagamentBean>>
    ) {
        executeResp({ service.getProductTypeListByProductId(productId) }, stateLiveData)
    }

    /**
     * app端通过组织id查询阿米巴下的所有客户接口
     */
    suspend fun getAmibaCustomerListByOrgId(
        orgId: Int,
        stateLiveData: StateLiveData<MutableList<AmeobaCustomerListBean>>
    ) {
        executeResp({ service.getAmibaCustomerListByOrgId(orgId) }, stateLiveData)
    }

    /**
     * app端查询阿米巴某个客户下的所有项目接口
     */
    suspend fun getProjectByCustomerId(
        customerId: Int,
        stateLiveData: StateLiveData<MutableList<ProjectByCustomerBean>>
    ) {
        executeResp({ service.getProjectByCustomerId(customerId) }, stateLiveData)
    }


    /**
     * app端获取某个阿米巴下的全部研发项目信息接口
     */
    suspend fun getAmibaProjectListByOrgId(
        orgId: Int,
        stateLiveData: StateLiveData<MutableList<AmibaProjectListBean>>
    ) {
        executeResp({ service.getAmibaProjectListByOrgId(orgId) }, stateLiveData)
    }

    /**
     * app端下拉框获取全部合同编号及信息接口
     */
    suspend fun getCompanyContractNumList(stateLiveData: StateLiveData<MutableList<CompanyContractNumBean>>) {
        executeResp({ service.getCompanyContractNumList() }, stateLiveData)
    }


    /**
     * app端获取某个阿米巴审批人的列表接口
     */
    suspend fun getAmibaSysUserAdminByOrgId(stateLiveData: StateLiveData<MutableList<AmibaSysUserAdminBean>>) {
        executeResp({ service.getAmibaSysUserAdminByOrgId() }, stateLiveData)
    }


    /**
     * app端获取商务管理员（审批人）的列表接口
     */
    suspend fun getCompanySysUserAdmin(stateLiveData: StateLiveData<MutableList<AmibaSysUserAdminBean>>) {
        executeResp({ service.getCompanySysUserAdmin() }, stateLiveData)
    }

    //####################################其他#######################################


    /**
     * app端获取商务管理员（审批人）的列表接口
     */
    suspend fun addCompanyContractDistribution(
        contractDistributionType:Int,orgId: Int, orgName: String, customerId: Int, customerName: String,
        amibaCustomerProjectId: Int, projectName: String, companyContractId: Int,
        contractNo: String, divideMoney: String,createUser:String,
        stateLiveData: StateLiveData<BaseBean>
    ) {
        executeResp({
            service.addCompanyContractDistribution(
                contractDistributionType,
                orgId,
                orgName,
                customerId,
                customerName,
                amibaCustomerProjectId,
                projectName,
                companyContractId,
                contractNo,
                divideMoney,
                createUser
            )
        }, stateLiveData)
    }

    /**
     * app端获取全部阿米巴组织接口
     */
    suspend fun getSysOrgAmibaList( stateLiveData: StateLiveData<MutableList<AmountAllocatedBean>>) {
        executeResp({ service.getSysOrgAmibaList()}, stateLiveData)
    }


}